<?php
('Access-Control-Allow-Origin：*');
include("../config/mysql.php");
$parameter = $_POST["parameter"];
$num = $_POST["num"];
$checkQuery = $_POST["checkQuery"];
$user_id = $_POST["user_id"];
$recycle_bin = $_POST["recycle_bin"];
$db = new mysql();
//sole  1  是单个  2 是批量
/* num   1是已报名 2是确认缴费  3取消报名   4取消缴费  5 删除学生 6修改报名老师 */

switch ($num) {
	case 0:
		$sql = "UPDATE students SET veteran = '{$parameter}'";
		break;
	case 1:
		$sql = "UPDATE students SET isBao = '1'";
		break;
	case 2:
		$sql = "UPDATE students SET ispay = '1'";
		break;
	case 3:
		$sql = "UPDATE students SET isBao = '0'";
		break;
	case 4:
		$sql = "UPDATE students SET ispay = '0'";
		break;
	case 5:
		if ($user_id == 3 && $recycle_bin == 1) {
			$sql = "DELETE FROM students";
		} else {
			$sql = "UPDATE students SET recycle_bin = 1";
		}
		break;
	case 6:
		$sql = "UPDATE students SET tid = '{$parameter}'";
		break;
	case 7:
		$sql = "UPDATE students SET school = '{$parameter}'";
		break;
	case 8:
		$sql = "UPDATE students SET signUpYear = '{$parameter}'";
		break;
	case 9:
		$sql = "UPDATE students SET signUpTime = '{$parameter}'";
		break;
	case 10:
		$sql = "UPDATE students SET recycle_bin = 0";
		break;
}

if ($checkQuery) {
	$sql .= " WHERE id IN ({$checkQuery})";
} else {
	$sql .= " WHERE id = '{$parameter}'";
}

echo $db->Query($sql);
$db->close();
